package auto.app.recv;

import auto.app.config.DirectRabbitConfig;
import auto.app.service.TestCollectionService;
import auto.app.util.UserGetAccount;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;

@Component
@RabbitListener(queues = DirectRabbitConfig.QUEUE_NAME)//监听的队列名称
@Slf4j
public class TestCollectionUploadReceiver {

    @Autowired
    private TestCollectionService testCollectionService;

    //执行测试合集
    @RabbitHandler
    public void process(Map testMessage) throws Exception {
        Integer id = (Integer)testMessage.get("id");
        Boolean aBoolean = (Boolean) testMessage.get("bool");
        Integer acconutId=(Integer)testMessage.get("acconutId");
        String accountName = (String)testMessage.get("accountName");
        Boolean execute = testCollectionService.execute(id, aBoolean,acconutId,accountName);
        log.info("测试合集执行结果  : " + execute.toString());
    }


}
